import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

class Demo3_1_4_4 {
    @SuppressWarnings("SimplifyStreamApiCallChains")
    public static void main(String[] args) {
        List<Integer> list = Arrays.asList(1, 1, 1, 2, 2);
        System.out.println("--------------- toSet 前");
        System.out.println(list);
        System.out.println("--------------- toSet 后");
        Set<Integer> set = list.stream().collect(Collectors.toSet());
        System.out.println(set);
    }
}